<template>
<!-- 新闻详情 -->
  <div class="news-detail">
    <div class="news-title" v-if="detailData.title">{{detailData.title}}</div>
    <div class="new-time" v-if="detailData.time">
      发布于{{ detailData.time }}
    </div>
    <div class="news-content" v-html="detailData.content"></div>
    <!-- 视频播放器 -->
    <div class="news-video" v-if="detailData.videoUrl">
      <video width="100%" height="300" controls>
        <source :src="detailData.videoUrl" type="video/mp4" />
      </video>
    </div>
    <slot name="other"></slot>
    <!-- 附件 -->
    <div class="file-ws" v-if="detailData.files && detailData.files.length > 0">
      附件:
      <div>
        <a
          v-for="(item, index) in detailData.files"
          href="javascript:;"
          :key="index"
          @click="handleDownload(item)"
          >{{ item.name }}</a
        >
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "skyNewsDetail",
  props: {
    detailData: {
      type: Object,
      default: () => {},
    },
  },
  methods: {
    handleDownload(item) {
      this.$emit('download',item)
    },
  },
};
</script>

<style lang="less" scoped>
.news-detail {
  .news-title {
    font-size: 18px;
    text-align: center;
    font-weight: bold;
  }
  .new-time {
    text-align: center;
    margin: 10px;
    font-size: 13px;
    color: #999;
  }
  .news-content {
    text-indent: 2em;
    font-size: 14px;
    margin: 10px 0;
  }
  .news-video {
    margin: 10px 0;
  }
  .file-ws {
    text-align: left;
    font-size: 12px;
    margin-top: 20px;
    a {
      color: #1989fa;
    }
  }
}
</style>